package com.example.demo.controller;

import com.example.demo.entity.User;
import com.example.demo.service.LoginService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

@RestController
public class LoginController {

    @Autowired
    LoginService loginService;

    @RequestMapping("login")
    public String loginCheck(@RequestParam("username")String username,@RequestParam("password") String password){
        System.out.println(username+password);
        User user = new User();
        user.setUsername(username);
        user.setPassword(password);
        return ""+loginService.getPasswordByUsername(user);
    }

}
